package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.entity.Student;

import java.util.List;

//springboot整合mybatis，需要在mapper接口上，添加@Mapper注解，否则接口不能有效识别
@Mapper
public interface StudentMapper {
    @Insert("insert into t_student(id,name,age) values(#{id},#{name},#{age})")
    void insert(Student s);
    @Update("update t_student set name=#{name},age=#{age} where id=#{id}")
    void update(Student s);
    @Delete("delete from t_student where id=#{id}")
    void delete(String id);
    @Select("select * from t_student")
    List<Student> getAll();
    @Select("select * from t_student where id=#{id}")
    Student getById(String id);
}
